/**
 * Created by Eric on 2017/9/1.
 * Depending on the jquery-1.12.4.min.js.
 * Depending on the layer.js.
 * Depending on the layui.js.
 * Depending on the layui.css.
 * To cite this document, always state the source as shown above.
 * -------------------------------
 * Module:封装公共方法
 * -------------------------------
 */
var erp = {

}

//分页显示组件
erp.laypage = function(_option,callback){
    /*Arg Guide
     @ _option.id  分页id
     @ _option.curr  显示第几页
     @ _option.pages  显示页数
    */
    layui.use(['laypage', 'layer'], function () {
        var laypage = layui.laypage;
        laypage({
            cont: _option.id,
            curr: _option.curr || 1,//默认为第一页
            pages: _option.pages,
            skin: '#457fe6',
            skip: true,
            jump:function (obj,first) {
                /*@ obj 为当前分页对象
                * 例  obj.curr 点击第几页
                * */
                if(!first){
                    callback(obj);//点击回调函数
                }
            }
        });
    });
}


